package cn.matezk.lianlian.service.impl;

import cn.matezk.lianlian.dao.SecretKeyDao;
import cn.matezk.lianlian.model.SecretKey;
import cn.matezk.lianlian.service.ISecretKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SecretKeyService implements ISecretKeyService {
    @Autowired
    private SecretKeyDao secretKeyDao;

    @Override
    @Cacheable(cacheNames = "secretKey", unless = "#result == null", key = "#appKey")
    public SecretKey selectByAppKey(String appKey) {
        return secretKeyDao.selectByAppKey(appKey);
    }

    @Override
    public List<SecretKey> selectAll() {
        return secretKeyDao.selectAll();
    }
}
